#ifndef __CONFIG_H__
#define __CONFIG_H__

#include "shyper_service.h"
#include "vmm.h"

#define NAME_MAX_LENGTH (32)
#define CFG_MAX_NUM (0x10)
#define IRQ_MAX_NUM (0x40)
#define MAX_COLOR_NUM (64)

struct vm_kernel_image_info {
    u64 vm_id;
    char image_name[NAME_MAX_LENGTH];
};

extern int vm_num;
extern struct vm_kernel_image_info vm_kernel_image_info_list[];

struct vm_add_config_arg {
    u64 vm_name_addr;
    u64 vm_name_length;
    u64 vm_type;
    u64 cmd_line_addr;
    u64 cmd_line_length;
    u64 kernel_load_ipa;
    u64 device_tree_load_ipa;
    u64 ramdisk_load_ipa;
    u64 vm_id_addr;
};

struct vm_set_cpu_config_arg {
    u64 vmid;
    u32 num;
    u32 allocate_bitmap;
    i32 master;
};

struct vm_add_memory_region_config_arg {
    u64 vmid;
    u64 ipa_start;
    u64 length;
};

struct vm_memory_color_budget_config_arg {
    u64 vmid;
    u64 color_num;
    u64 color_array_addr;
    u32 budget;
};

struct vm_add_emulated_device_config_arg {
    u64 vmid;
    u64 dev_name_addr;
    u64 dev_name_length;
    u64 base_ipa;
    u64 length;
    u64 irq_id;
    u64 cfg_list_addr;
    u64 cfg_list_length;
    u64 emu_type;
};

struct vm_add_passthrough_device_region_config_arg {
    u64 vmid;
    u64 base_ipa;
    u64 base_pa;
    u64 length;
};

struct vm_add_passthrough_device_irqs_config_arg {
    u64 vmid;
    u64 irqs_addr;
    u64 irqs_length;
};

struct vm_add_passthrough_device_streams_ids_config_arg {
    u64 vmid;
    u64 streams_ids_addr;
    u64 streams_ids_length;
};

struct vm_add_dtb_device_config_arg {
    u64 vmid;
    u64 dev_name_addr;
    u64 dev_name_length;
    u64 dev_type;
    u64 irq_list_addr;
    u64 irq_list_length;
    u64 addr_region_ipa;
    u64 addr_region_length;
};

struct vm_load_kernel_img_file_arg {
    u64 vmid;
    u64 img_size;
    u64 cache_ipa;
    u64 load_offset;
    u64 load_size;
};

bool hvc_config_add_vm(u64 arg);
bool hvc_config_delete_vm(u64 arg);
bool hvc_config_vm_cpu(u64 arg);
bool hvc_config_vm_memory_region(u64 arg);
bool hvc_config_vm_emulated_device(u64 arg);
bool hvc_config_vm_passthrough_device_region(u64 arg);
bool hvc_config_vm_passthrough_device_irqs(u64 arg);
bool hvc_config_vm_passthrough_device_streams_ids(u64 arg);
bool hvc_config_vm_dtb_device(u64 arg);
bool hvc_config_vm_upload_kernel_image(u64 arg);
bool hvc_config_vm_memory_color_budget(u64 arg);
bool hvc_config_vm_upload_device_tree(u64 arg);
#endif
